package cn.kevinproject.dingtalk_robot.controller;

import cn.kevinproject.dingtalk_robot.client.Producer;
import cn.kevinproject.dingtalk_robot.client.ProducerFactory;
import cn.kevinproject.dingtalk_robot.msg.Message;
import cn.kevinproject.dingtalk_robot.msg.PlainTextMessage;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.TestOnly;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kevin lau (双鹰)
 */
@RestController
@RequestMapping("test")
@TestOnly
@RequiredArgsConstructor
public class TestController {

    private final ProducerFactory producerFactory;

    @GetMapping("plain")
    public void send(){
        Producer producer = producerFactory.buildProducer("Java");
        PlainTextMessage message = new PlainTextMessage();
        message.setText("hahahhahahah");
        producer.sendMsg(message);
    }
}
